package com.tian.recall.controller;

import com.tian.common.core.controller.BaseController;
import com.tian.common.core.page.TableDataInfo;

import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.tian.recall.domain.Image;
import com.tian.recall.service.IImageService;

/**
 * 回忆相册 信息操作处理
 *
 * @author zcx
 * @date 2021-08-25 16:06:03
 */
@Controller
@RequestMapping("/recall/image")
public class ImageController extends BaseController {
    private String prefix = "recall/image";

	@Autowired
	private IImageService imageService;

	/**
	 * 查询回忆相册列表
	 */
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(Image image){
		startPage();
        List<Image> list = imageService.selectImageList(image);
		return getDataTable(list);
	}

	/**
	 * 新增保存回忆相册
	 */
	@PostMapping("/add")
	@ResponseBody
	public String addSave(Image image){
		return toAjax(imageService.insertImage(image));
	}

	/**
	 * 修改保存回忆相册
	 */
	@PostMapping("/edit")
	@ResponseBody
	public String editSave(Image image){
		return toAjax(imageService.updateImage(image));
	}

	/**
	 * 删除回忆相册
	 */
	@PostMapping( "/remove")
	@ResponseBody
	public String remove(long id){
		return toAjax(imageService.deleteImageById(id));
	}

	/**
	 * 删除回忆相册
	 */
	@PostMapping( "/removes")
	@ResponseBody
	public String removes(String ids){
		return toAjax(imageService.deleteImageByIds(ids));
	}

}
